package com.app.mapper;

import cn.hutool.json.JSONObject;
import com.app.model.*;
import com.app.vo.Top10VO;
import com.app.vo.TurnoverTrendVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.sql.Timestamp;
import java.util.List;
import java.util.Map;


@Mapper
public interface AdminHomepageMapper {


    List<Top10VO> search(@Param("beginTime") Timestamp beginTime, @Param("endTime") Timestamp endTime, @Param("user") AdminUserModel user);

    /**
     * 营业走势实现
     */
    List<JSONObject> turnoverTrend(@Param("params") Map<String, Object> params);

    /**
     * 商家营业额
     *
     * @param params
     * @return
     */
    List<JSONObject> turnoverTrendApi(@Param("params") Map<String, Object> params);

    /**
     * 每日业务趋势
     *
     * @param businessId 业务id
     * @param areaId     区域id
     * @param cityId     城市id
     * @return {@link List}<{@link TurnoverTrendVo}>
     */
//    List<TurnoverTrendVo> businessTrendByDay(@Param("businessId") Integer businessId, @Param("areaId") Integer areaId, @Param("cityId") Integer cityId);

    /**
     * 抽层流水走势
     *
     * @param businessId 业务id
     * @param areaId     区域id
     * @param cityId     城市id
     * @return {@link List}<{@link TurnoverTrendVo}>
     */
    List<TurnoverTrendVo> businessTrendByMonth(@Param("businessId") Integer businessId, @Param("areaId") Integer areaId, @Param("cityId") Integer cityId);

    /**
     * 年度业务趋势
     *
     * @param businessId 业务id
     * @param areaId     区域id
     * @param cityId     城市id
     * @return {@link List}<{@link TurnoverTrendVo}>
     */
    List<TurnoverTrendVo> businessTrendByYear(@Param("businessId") Integer businessId, @Param("areaId") Integer areaId, @Param("cityId") Integer cityId);

    /**
     * 每日营业额趋势
     *
     * @param businessId 业务id
     * @param areaId     区域id
     * @param cityId     城市id
     * @return {@link List}<{@link TurnoverTrendVo}>
     */
    List<TurnoverTrendVo> turnoverTrendByDay(@Param("businessId") Integer businessId, @Param("areaId") Integer areaId, @Param("cityId") Integer cityId);

    /**
     * 每周营业额趋势
     *
     * @param businessId 业务id
     * @param areaId     区域id
     * @param cityId     城市id
     * @return {@link List}<{@link TurnoverTrendVo}>
     */
    List<TurnoverTrendVo> turnoverTrendByWeek(@Param("businessId") Integer businessId, @Param("areaId") Integer areaId, @Param("cityId") Integer cityId);

    /**
     * 月营业额趋势
     *
     * @param businessId 业务id
     * @param areaId     区域id
     * @param cityId     城市id
     * @return {@link List}<{@link TurnoverTrendVo}>
     */
    List<TurnoverTrendVo> turnoverTrendByMonth(@Param("businessId") Integer businessId, @Param("areaId") Integer areaId, @Param("cityId") Integer cityId);

    /**
     * 年营业额趋势
     *
     * @param businessId 业务id
     * @param areaId     区域id
     * @param cityId     城市id
     * @return {@link List}<{@link TurnoverTrendVo}>
     */
    List<TurnoverTrendVo> turnoverTrendByYear(@Param("businessId") Integer businessId, @Param("areaId") Integer areaId, @Param("cityId") Integer cityId);
    /**
     * 账单报告
     *
     * @param params
     * @return
     */
    List<JSONObject> financialStatements(@Param("params") Map<String, Object> params);

    /**
     * 订单管理的数据统计查询
     * @param
     * @return
     */
//    JSONObject goodsOrdernews(AdminUserModel user);

    JSONObject goodsOrdernews(@Param("businessId") Integer businessId, @Param("cityId") Integer cityId, @Param("areaId") Integer areaId);

    /**
     * 活动订单的数据统计查询
     * @param businessId
     * @param cityId
     * @param areaId
     * @return
     */
    JSONObject activityOrderNews(@Param("businessId") Integer businessId, @Param("cityId") Integer cityId, @Param("areaId") Integer areaId);

    /**
     * 会员开通数据统计
     * @param businessId
     * @param cityId
     * @param areaId
     * @return
     */
    JSONObject vipNews(@Param("businessId") Integer businessId, @Param("cityId") Integer cityId, @Param("areaId") Integer areaId);

    /**
     * 用户管理统计数据查询
     *
     * @param businessId
     * @param cityId
     * @param areaId
     * @param ifVip
     * @return
     */
    JSONObject userNews(@Param("businessId") Integer businessId, @Param("cityId") Integer cityId, @Param("areaId") Integer areaId, @Param("ifVip") Integer ifVip);

    /**
     * 用户id
     * 查询满足条件的用户ids
     *
     * @param area      面积
     * @param userm     用户
     * @param beginTime 开始时间
     * @param endTime   结束时间
     * @return {@link List}<{@link Integer}>
     */
    Double userIds(@Param("area") Integer area, @Param("user") AdminUserModel userm,
                    @Param("beginTime") String beginTime,
                    @Param("endTime") String endTime);

    Double statisticsOnTotalAmountCouponsIssuedByPlatform(@Param("area") Integer area, @Param("user") AdminUserModel userm,
                        @Param("beginTime") String beginTime,
                        @Param("endTime") String endTime);

    IPage<VoucherRecordModel> statisticsOnTotalAmountCouponsIssuedByPlatformList(IPage<VoucherRecordModel> page,@Param("area") Integer area, @Param("user") AdminUserModel userm,
                                                                                 @Param("beginTime") String beginTime,
                                                                                 @Param("endTime") String endTime);

    Double vipAmount(@Param("area") Integer area, @Param("user") AdminUserModel userm,
                     @Param("beginTime") String beginTime,
                     @Param("endTime") String endTime);

    Map<String, Object> drawRecord(@Param("area") Integer area, @Param("user") AdminUserModel userm,
                                   @Param("beginTime") String beginTime,
                                   @Param("endTime") String endTime);

    Double totalPumping(@Param("area") Integer area, @Param("user") AdminUserModel userm,
                        @Param("beginTime") String beginTime,
                        @Param("endTime") String endTime);

    Double totalPoints(@Param("area") Integer area, @Param("user") AdminUserModel userm,
                                                  @Param("beginTime") String beginTime,
                                                  @Param("endTime") String endTime);

    Double totalCirculation(@Param("area") Integer area, @Param("user") AdminUserModel userm,
                            @Param("beginTime") String beginTime,
                            @Param("endTime") String endTime);

    IPage<IntegralRecordModel> totalPointsDetails(IPage<IntegralRecordModel> page,@Param("area") Integer area, @Param("user") AdminUserModel userm,
                                                  @Param("beginTime") String beginTime,
                                                  @Param("endTime") String endTime);

    IPage<VoucherRecordModel> totalCirculationDetails(IPage<VoucherRecordModel> page,@Param("area") Integer area, @Param("user") AdminUserModel userm,
                                                      @Param("beginTime") String beginTime,
                                                      @Param("endTime") String endTime);

    Double howMuchDoYouSpendAndHowMuchDoYouSend(@Param("beginTime") String beginTime,
                                                @Param("endTime") String endTime);

    Double howMuchDoYouSpendAndHowMuchPartner(@Param("beginTime") String beginTime,
                                              @Param("endTime") String endTime);

    Double districtCouponVolume(@Param("beginTime") String beginTime,
                                @Param("endTime") String endTime);

    Double platformVoucherQuantity(@Param("beginTime") String beginTime,
                                   @Param("endTime") String endTime);

    IPage<VoucherRecordModel> howMuchDoYouSpendAndHowMuchDoYouSendList(Page p, @Param("beginTime") String beginTime,
                                                                       @Param("endTime") String endTime);

    IPage<VoucherRecordModel> howMuchDoYouSpendAndHowMuchPartnerList(Page p, @Param("beginTime") String beginTime,
                                                                     @Param("endTime") String endTime);

    IPage<VoucherRecordModel>  districtCouponVolumeList(Page p, @Param("beginTime") String beginTime,
                                                        @Param("endTime") String endTime);

    IPage<PlatformChangeRecord> platformVoucherQuantityList(Page p, @Param("beginTime") String beginTime,
                                                            @Param("endTime") String endTime);

    Double transferDataTotalAmountCirculatingCoupons( @Param("beginTime") String beginTime,
                                                      @Param("endTime") String endTime);

    Double amountCouponsReceivedByFriends(@Param("beginTime") String beginTime,
                                          @Param("endTime") String endTime);

    Double transferFee(@Param("beginTime") String beginTime,
                       @Param("endTime") String endTime);

    Map<String, Object> draw(@Param("beginTime") String beginTime,
                             @Param("endTime") String endTime);

    IPage<VoucherRecordModel>  transferDataTotalAmountCirculatingCouponsList(Page p, @Param("beginTime") String beginTime,
                                                                             @Param("endTime") String endTime);

    IPage<VoucherRecordModel>  amountCouponsReceivedByFriendsList(Page p,@Param("beginTime") String beginTime,
                                              @Param("endTime") String endTime);

    IPage<VoucherRecordModel> transferFeeList(Page p,@Param("beginTime") String beginTime,
                           @Param("endTime") String endTime);

    IPage<DividedIntoRecord> drawList(Page p, @Param("beginTime") String beginTime,
                                      @Param("endTime") String endTime);

    Double memberRechargeAmount(@Param("area") Integer area, @Param("user") AdminUserModel userm,
                                @Param("beginTime") String beginTime,
                                @Param("endTime") String endTime);

    IPage<PurchaseCouponsRecord> rechargeAmountList(Page p,@Param("mobile") String mobile, @Param("user") AdminUserModel userm,
                              @Param("beginTime") String beginTime,
                              @Param("endTime") String endTime);
}
